import { storage } from '@/utils/Storage';
import { MutationType } from '@/enums/userEnums';

export type State = {
    token: string;
    username: string;
    nickName: string;
    password: string;
    avatar: string;
    userInfo: { [x: string]: any };
    isRemember: boolean;
    roles: string[];
};

export const state: State = {
    token: storage.get(MutationType.SetToken, ''),
    username: storage.get(MutationType.SetName, ''),
    nickName: storage.get(MutationType.SetNickName, ''),
    password: storage.get(MutationType.SetPassword, ''),
    avatar: storage.get(MutationType.SetAvatar, ''),
    userInfo: storage.get(MutationType.SetInfo, {}),
    roles: storage.get(MutationType.SetRole, []),
    isRemember: storage.get(MutationType.SetInfo, false),
};
